<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>恒铸智能柜管理平台</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport"
	content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="format-detection" content="telephone=no">
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/resources/layui/css/layui.css"
	media="all" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/resources/layui/layui.js"></script>
</head>
<style>
.laytable-cell-1-url {
	width: 340px !important;
}
</style>
<body>
	<form style="padding: 20px;">
		<div class="layui-form-item" style="display: none;">
			<label class="layui-form-label">柜子ID：</label>
			<div class="layui-input-inline">
				<input type="text" class="layui-input caseNo layui-disabled"
					disabled="disabled">
			</div>
		</div>
		<h3 style="margin-top: 20px; text-align: center;">使用截止时间</h3>
		<input type="text" class="layui-input useEndTime"
			style="margin-top: 30px;" id="time" autocomplete="off"
			placeholder="请输入使用时间"> <a id="submit" class="layui-btn"
			style="width: 100px; margin: 50px; margin-left: 85px;">提交</a>
	</form>
	<script>
    layui.use(['laydate', 'layer', 'jquery'], function () {
        var $ = layui.jquery,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            laydate = layui.laydate;

        var time = $("#time").val();
        laydate.render({
            elem: '#time' //指定元素
            , type: 'datetime'
            , trigger: 'click'
            , done: function (value, date, endDate) {
                //console.log(value);
                time = value //得到日期生成的值，如：2017-08-18
            }
        });

        $("#submit").on("click", function () {
            var caseNo = $(".caseNo").val()
            // console.log(caseNo)
            $.post("/caseUseTime/setUseEndTime?caseNo=" + caseNo + "&useEndTime=" + time, function (res) {
                if (res.success) {
                    layer.msg(res.message)
                    parent.window.location.reload();
                } else {
                    layer.msg(res.message)
                }
            })
        })

    })
</script>
</body>
</html>